﻿using UnityEngine;
using System.Collections;

public class KeyboardController : MonoBehaviour {

	public int speed = 25;

	// Update is called once per frame, deltaTime varies
	void Update () {
		characterControl();
	}

	void characterControl(){
		//physicsbased Movement
		if (Input.GetKey(KeyCode.W)) {
			rigidbody.AddForce (transform.up * speed);
		}
		if (Input.GetKey(KeyCode.S)) {
			
			rigidbody.AddForce (-transform.up * speed);
		}
		if (Input.GetKey(KeyCode.D)) {			
			rigidbody.AddForce (transform.right * speed);
		}
		if (Input.GetKey(KeyCode.A)) {			
			rigidbody.AddForce (-transform.right * speed);
		}
	}
}
